package com.itheima.reggie.controller;

import com.itheima.reggie.common.ResultInfo;
import com.itheima.reggie.domain.Dish;
import com.itheima.reggie.domain.Setmeal;
import com.itheima.reggie.service.DishService;
import com.itheima.reggie.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

// app菜品模块
@RestController
public class DishController {


    @Autowired
    private DishService dishService;

    @Autowired
    private SetmealService setmealService;

    // 列表查询所有菜品
    @GetMapping("/dish/list")
    public ResultInfo findList(Long categoryId,Integer status){//接受参数
      //  调用方法
        List<Dish> dishList=dishService.findList(categoryId,status);
        // 返回结果
        return ResultInfo.success(dishList);
    }

    //列表查询所有的套餐
    @GetMapping("/setmeal/list")
    public ResultInfo findSetmeal(Long categoryId,Integer status){// 接收参数
        // 调用方法
      List<Setmeal> setmeals=  setmealService.findSetmeal(categoryId,status);
      // 返回结果
        return ResultInfo.success(setmeals);
    }

}
